<?php

namespace com\aristo\ingenieros\view;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

use \stdClass;

/**
 * Metodo de respuesta del servicio si es STRING es ERROR
 *
 * @author ARISTO INGENIEROS
 */
class Response {

    public static $STATUS_OK = "OK";
    public static $STATUS_ERROR = "ERROR";
    
    private $result;

    function __construct() {
        $this->result = "";
    }

    public function setResult($result) {
        $this->result = $result;
    }

    public function getResult() {
        return $this->result;
    }

    public function getType() {
        return ($this->result instanceof stdClass) ? "OBJETO" : (is_array($this->result) ? "ARRAY" : "STRING");
    }

    public function getStatus() {
        return ($this->getType() == "STRING") ? Response::$STATUS_ERROR : Response::$STATUS_OK;
    }
}